package com.lagou.rpc.provider.service;

import com.lagou.rpc.api.IProductcodeService;
import com.lagou.rpc.pojo.Product;
import com.lagou.rpc.provider.anno.RpcService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@RpcService
@Service
public class ProductServiceImpl implements IProductcodeService {

    private static Map<Integer,Product> map = new HashMap();

    static {
        Product product = new Product(1, "2000.00", "羽绒服");
        Product product2 = new Product(2, "10.00", "袜子");
        map.put(1,product);
        map.put(2,product2);
    }

    @Override
    public Product getProductById(Integer id) {

        return map.get(id);
    }
}
